package com.itzhigui.controller;

import com.itzhigui.entity.User;
import com.itzhigui.service.UserService;
import com.itzhigui.utils.ResponseUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author java1412
 * @since 2023-11-08 17:05:41
 */
@RestController
@Slf4j
@CrossOrigin
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping(value = "/user/login")
    public ResponseUtil login(
            @RequestBody User user
    ) {
        return userService.findByNamedAndPwd(user);
    }
}
